package cn.assumejson.springframework.aop.bean;

import cn.assumejson.springframework.aop.BeforeAdvice;
import cn.assumejson.springframework.aop.MethodBeforeAdvice;
import cn.assumejson.springframework.beans.factory.annotation.Autowired;
import cn.assumejson.springframework.beans.factory.annotation.Value;
import cn.assumejson.springframework.context.stereotype.Component;
import lombok.extern.slf4j.Slf4j;

import java.lang.reflect.Method;

/**
 * @author Mr. Li
 * @version 1.0
 * @since 1.0 2021/12/2 15:48
 */
@Slf4j
//@Component
public class UserServiceBeforeAdvice implements MethodBeforeAdvice {

    @Value("${token}")
    private String token;

//    @Autowired
//    private UserDao userDao;

    @Override
    public void before(Method method, Object[] args, Object target) throws Throwable {
        log.info("AOP is running.........................");
        System.out.println("拦截方法：" + method.getName());
    }
}
